<template>
  <el-form :model="form" label-width="150px">
    <el-form-item v-show="data.username" label="提交用户:">
      {{ data.username }}
    </el-form-item>
    <el-form-item v-show="data.question" label="题目名称:">
      {{ data.question ? data.question.name : "" }}
    </el-form-item>
    <el-form-item v-show="data.user" label="提交用户:">
      {{ data.user ? data.user.name : "" }}
    </el-form-item>

    <el-form-item v-show="data.userid" label="提交用户id:">
      {{ data.userid }}
    </el-form-item>
    <el-form-item v-show="data.courseid" label="视频id:">
      {{ data.courseid }}
    </el-form-item>
    <el-form-item v-show="data.createdAt" label="提交时间:">
      {{ TimeYH(data.createdAt) }}
    </el-form-item>
    <el-form-item v-show="data.context" label="提交内容:">
      <div v-html="data.context" class="editor-content-view"></div>
    </el-form-item>
    <el-form-item label="是否置顶">
      <el-select v-model="data.top">
        <el-option label="不置顶" :value="0" />
        <el-option label="置顶" :value="1" />
      </el-select>
    </el-form-item>
    <el-form-item label="审核状态">
      <el-select v-model="data.state">
        <el-option label="不通过" :value="0" />
        <el-option label="通过" :value="1" />
      </el-select>
    </el-form-item>
    <el-form-item label="备注:">
      <el-input v-model="data.examine" :rows="4" type="textarea"></el-input>
    </el-form-item>
    <el-form-item label="保存">
      <el-button @click="click">保存</el-button>
    </el-form-item>
  </el-form>
</template>

<script setup lang="ts">
import {
  reactive,
} from "vue";

import Studycodemodel from "../../../mysql_interface/studycodemodel";
import { TimeYH } from '../../../util/time'
const p = defineProps<{ data: Studycodemodel.Iquestioncomment, update: (data: Studycodemodel.Iquestioncomment) => void }>()

const e = defineEmits<{
  (event: 'change'): void
  (event: 'update', id: Studycodemodel.Iquestioncomment): void
}>()


function click() {
  p.update(p.data)
}



const form = reactive({
  name: "",
  context: "",
});

</script>

<style scoped>
pre {
  background-color: #f8f8f8;
  margin: 0.5em 0;
  padding: 0.3em 0.5em;
  border: #ddd solid 1px;
  border-radius: 3px;
  overflow: auto;
  font-size: 0.875em;
  font-family: monospace;
  min-height: 30px;
}

.span1 {
  display: inline-block;
  line-height: 26px;
  color: var(--color-cheng);
}
</style>
